cmake_minimum_required(VERSION 3.0.2)
project(jr_identify)

add_definitions(-std=c++11)
add_definitions(-DAPI_EXPORTS)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)

#SET(cv_bridge_DIR /usr/local/share/cv_bridge/cmake/)
find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport roscpp std_msgs std_srvs sensor_msgs swarm_msgs camera_info_manager)

set(CMAKE_CUDA_COMPILER /usr/local/cuda-10/bin/nvcc)
enable_language(CUDA)
catkin_package(
)
 
# include and link dirs of cuda and tensorrt, you need adapt them if yours are different
# cuda
include_directories(/usr/local/cuda-10/include)
include_directories(/usr/local/cuda-10/targets/aarch64-linux/include/)
link_directories(/usr/local/cuda-10/lib64)

# tensorrt
include_directories(/home/nvidia/TensorRT-8.2.5.1/include/)
link_directories(/home/nvidia/TensorRT-8.2.5.1/lib/)

#SET(OpenCV_INCLUDE_DIRS /home/nvidia/opencv-4.5.4/include/opencv4/opencv2/)
SET(OpenCV_DIR  /home/nvidia/opencv-4.5.4/lib/cmake/opencv4/)
#find_package(OpenCV 4 REQUIRED PATHS /home/nvidia/opencv-4.5.4/lib/cmake/opencv4/)
find_package(OpenCV 4.5.4 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(
  include  
  ${catkin_INCLUDE_DIRS}
  /home/nvidia/jr_identify_ws/src/yolo_det/jr_identify/src/src
  /home/nvidia/jr_identify_ws/src/yolo_det/jr_identify/src/plugin
  
)
file(GLOB_RECURSE SRCS /home/nvidia/jr_identify_ws/src/yolo_det/jr_identify/src/src/*.cpp /home/nvidia/jr_identify_ws/src/yolo_det/jr_identify/src/src/*.cu)
file(GLOB_RECURSE PLUGIN_SRCS /home/nvidia/jr_identify_ws/src/yolo_det/jr_identify/src/plugin/*.cu)



add_library(myplugins SHARED ${PLUGIN_SRCS} ${SRCS})
target_link_libraries(myplugins nvinfer cudart)

add_executable(jr_identify src/get_img_ros.cpp)

target_link_libraries(jr_identify ${catkin_LIBRARIES} ${OpenCV_LIBS})
target_link_libraries(jr_identify nvinfer)
target_link_libraries(jr_identify cudart)
target_link_libraries(jr_identify myplugins)


message(STATUS "library status:")
message(STATUS "OpenCV_VERSION: ${OpenCV_VERSION}")
message(STATUS "OpenCV_LIBS: ${OpenCV_LIBS}")
message(STATUS "OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV_DIR: ${OpenCV_DIR}")
message(STATUS "catkin libraries: ${catkin_LIBRARIES}")
message(STATUS "cv_bridge_DIR: ${cv_bridge_DIR}")
message(STATUS "OpenCV_LIBRARIES: ${OpenCV_LIBRARIES}")













































